class  Car:
    """溢出模拟汽车的简单尝试"""
    def __init__(self, make, model, year):
        """初始化描述汽车的属性"""
        self.make = make
        self.model = model
        self.year = year
        self.odometer_reading = 0
    def get_descriptive_name(self):
        """返回格式规范的描述性名称"""
        long_name = str(self.year) + ' ' + self.make + ' ' + self.model
        return long_name.title()
    def read_odometer(self):
        """指出汽车的行驶里程"""
        print(f"This car has {self.odometer_reading} miles on it.")
    def update_odometer(self, miles):
        """将里程表读数设置为给定的值"""
        self.odometer_reading = miles
    def increment_odometer(self, miles):
        """让里程表读书增加给定的量"""
        self.odometer_reading += miles
    def fill_gas_tank(self):
        """电动汽车没有油箱"""
        print("This car does fill its gas tank!")
class Battery:
    """初始化电池的属性"""
    def __init__(self, battery_size=40):
        self.battery_size = battery_size
    """打印一条描述电池容量的消息"""
    def describe_battery(self):
        print(f"This car has a {self.battery_size}-kwh battery.")
class ElectricCar(Car):
    def __init__(self, make, model, year):
        """初始化父类的属性"""
        """先初始化父类的属性，再初始化电动汽车特有的属性"""
        super().__init__(make, model, year)
        self.battery_size = Battery()
    def describe_battery(self):
        """打印描述电池容量的信息"""
        print(f"This car has a {self.battery_size} kWh battery.")
    def fill_gas_tank(self):
        """电动汽车没有油箱"""
        print("This car does not fill its gas tank!")

my_leaf = ElectricCar('Fuga', 'leaf', 2016)
print(my_leaf.get_descriptive_name())
my_leaf.battery_size.describe_battery()